import { defHttp } from '@/utils/http/axios';

enum Api {
  SiteInfo = '/basic-api/v2/admin/site/info',
  SiteUpdate = '/basic-api/v2/admin/site/update',

  HelpPage = '/basic-api/v1/admin/cms/page/page',
  HelpAdd = '/basic-api/v1/admin/cms/page/add',
  HelpDelete = '/basic-api/v1/admin/cms/page/delete',

  AdPage = '/basic-api/v1/admin/shop/ad/page',
  AdAdd = '/basic-api/v1/admin/shop/ad/add',
  AdDelete = '/basic-api/v1/admin/shop/ad/delete',

  BannerList = '/basic-api/v1/admin/shop/banner/list',
  BannerAdd = '/basic-api/v1/admin/shop/banner/add',
  BannerDelete = '/basic-api/v1/admin/shop/banner/delete',
  BannerStatus = '/basic-api/v1/admin/shop/banner/status',

  LinkList = '/basic-api/v1/admin/shop/link/list',
  LinkAdd = '/basic-api/v1/admin/shop/link/add',
  LinkDelete = '/basic-api/v1/admin/shop/link/delete',
  LinkStatus = '/basic-api/v1/admin/shop/link/status',

  SearchPage = '/basic-api/v1/admin/shop/search/page',
  SearchDelete = '/basic-api/v1/admin/shop/search/delete',
}

//网站设置

export const getSiteInfo = (params?: any) =>
  defHttp.post<any>({ url: Api.SiteInfo, params }, { isTransformResponse: true });
export const doSiteUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.SiteUpdate, params }, { isTransformResponse: false });

// 帮助中心
export const getHelpPage = (params?: any) =>
  defHttp.post<any>({ url: Api.HelpPage, params }, { isTransformResponse: true });
export const doHelpAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.HelpAdd, params }, { isTransformResponse: false });
export const doHelpDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.HelpDelete, params }, { isTransformResponse: false });

//ad

export const getAdPage = (params?: any) =>
  defHttp.post<any>({ url: Api.AdPage, params }, { isTransformResponse: true });
export const doAdAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.AdAdd, params }, { isTransformResponse: false });
export const doAdDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.AdDelete, params }, { isTransformResponse: false });

//banner
export const getBannerList = (params?: any) =>
  defHttp.post<any>({ url: Api.BannerList, params }, { isTransformResponse: true });
export const doBannerAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.BannerAdd, params }, { isTransformResponse: false });
export const doBannerDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.BannerDelete, params }, { isTransformResponse: false });
export const doBannerStatusUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.BannerStatus, params }, { isTransformResponse: false });

//link
export const getLinkList = (params?: any) =>
  defHttp.post<any>({ url: Api.LinkList, params }, { isTransformResponse: true });
export const doLinkAdd = (params?: any) =>
  defHttp.post<any>({ url: Api.LinkAdd, params }, { isTransformResponse: false });
export const doLinkDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.LinkDelete, params }, { isTransformResponse: false });
export const doLinkStatusUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.LinkStatus, params }, { isTransformResponse: false });

//search
export const getSearchPage = (params?: any) =>
  defHttp.post<any>({ url: Api.SearchPage, params }, { isTransformResponse: true });

export const doSearchDelete = (params?: any) =>
  defHttp.post<any>({ url: Api.SearchDelete, params }, { isTransformResponse: false });
